package com.tang.portal.facade.admin.sys;

import com.tang.common.properties.sys.CoolTeaProperties;
import com.tang.framework.config.SpringApplication;
import com.tang.framework.core.domain.HttpResult;
import com.tang.framework.core.facade.Facade;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * @author tang jun liang
 * @Date 2023/6/15 10:45
 */
@Service
public class SysConfigFacade extends Facade {




    public HttpResult<CoolTeaProperties> configInfo() {
        CoolTeaProperties coolTeaProperties = SpringApplication.getBean(CoolTeaProperties.class);
        return ok(coolTeaProperties);
    }

    public HttpResult<String> configUpdate(CoolTeaProperties coolTeaProperties) {
        CoolTeaProperties oldConfig = SpringApplication.getBean(CoolTeaProperties.class);
        BeanUtils.copyProperties(coolTeaProperties, oldConfig);
        return ok();
    }


}
